package com.export.resolve;

import com.export.utils.ExcelUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

public class InitMain {

    public static  void  main(String[] args) throws  Exception{
        Workbook wb = new HSSFWorkbook(); // or new XSSFWorkbook();
        Sheet sheet1 = wb.createSheet("new sheet");
//        String path = "D:\\statisReportTemplate.xls";
		String path = "D:\\template.xls";
        Map<String,Object> map = new HashMap<>();
        map.put("name","汉字");
        map.put("code","123456");
        map.put("now","2017-06-01");
        ExcelUtils.replaceExcel(path,wb, sheet1,map);
        OutputStream fileOut = new FileOutputStream("D:\\workbook.xls");
        wb.write(fileOut);
    }
}
